use jni::{objects::JObject, JNIEnv};

use crate::{error::AppErr, service, utils::path::IO_EXCEPTION};



pub const MAC_NAME: &'static str = "wlan0";
pub const SERVER_HOST: &'static str = "local.hontech-rdcenter.com";
pub const SERVER_TCP: u16 = 33335;
pub const SERVER_WEB: u16 = 33334;



#[no_mangle]
pub extern "system" fn Java_rustlib_service_Service_init(
    mut env: JNIEnv,
    cb: JObject,
) {

    fn init_impl(env: &mut JNIEnv, cb: JObject) -> Result<(), AppErr> {
        let cb = env.new_global_ref(cb)?;
        service::init(cb);
        Ok(())
    }

    if let Err(e) = init_impl(&mut env, cb) {
        _ = env.throw_new(IO_EXCEPTION, e.to_string());
    }
}









